package com.linln.modules.system.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linln.common.enums.StatusEnum;
import com.linln.common.utils.StatusUtil;
import com.linln.component.excel.annotation.Excel;
import com.linln.component.excel.enums.ExcelType;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author 小懒虫
 * @date 2018/8/14
 */
@Data
@Entity
@Table(name = "pcs_order_porters")
@ToString(exclude = {"dept", "roles"})
@EqualsAndHashCode(exclude = {"dept", "roles"})
@EntityListeners(AuditingEntityListener.class)
@SQLDelete(sql = "update pcs_order_porters" + StatusUtil.SLICE_DELETE)
@Where(clause = StatusUtil.NOT_DELETE)
@Excel("订单护工记录表")
public class OrderPorters implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Excel(value = "ID", type = ExcelType.EXPORT)
    private Long id;

    @CreatedDate
    @Excel("创建时间")
    private Date createTime;

    @LastModifiedDate
    @Excel("更新时间")
    private Date updateTime;
    @Transient
    private String updateTimeStr;

    @JsonIgnore
    private Long createUser;

    @JsonIgnore
    private Long updateUser;

    @Excel("订单id")
    private Long orderId; // 新增字段

    @Excel("护工id")
    private Long porterId; // 新增字段

    @Excel("护理公司id")
    private Long companyId; // 新增字段
    @Excel("服务状态 -1订单取消 0待确认 1服务中 2服务中时候结束 3服务未开始结束")
    private Integer serviceStatus; // 新增字段
    @Excel("订单类型")
    private Integer orderType; // 新增字段

    private Byte status = StatusEnum.OK.getCode(); // 新增字段

    @Excel("服务开始时间")
    private String timeStar; // 新增字段
    @Transient
    private String timeStarStr;


    @Excel("服务结束时间")
    private String timeEnd; // 新增字段

    @Transient
    private String timeEndStr;

    @Excel("更换方式1默认2患者申请更换3公司更换")
    private Integer type; // 新增字段

    @Transient
    private Porter porter;

}
